package com.torry.edss.domain.accessor.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.torry.edss.domain.model.LimitBomb;
import com.torry.edss.infras.entity.LimitBombDO;
import com.torry.edss.infras.entity.LimitDownDO;
import com.torry.edss.domain.model.LimitDown;
import com.torry.edss.infras.mapper.LimitDownMapper;
import com.torry.edss.domain.accessor.LimitDownAccessor;
import org.springframework.stereotype.Service;
import com.torry.boot.starter.mybatisplus.service.AccessorImpl;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author torry.wang
 * @since 2025-05-09
 */
@Service
@SuppressWarnings("DuplicatedCode")
public class LimitDownAccessorImpl extends AccessorImpl<LimitDownMapper, LimitDownDO, LimitDown> implements LimitDownAccessor {
    @Override
    public LimitDown toModel(LimitDownDO entity) {
        if (entity == null) return null;
        return new LimitDown();
    }

    @Override
    public LimitDownDO toEntity(LimitDown model) {
        if (model == null) return null;
        return new LimitDownDO();
    }

    @Override
    public int countByDate(String date) {
        return this.count(new LambdaQueryWrapper<LimitDownDO>().eq(LimitDownDO::getDate, date));
    }

    @Override
    public int countByDateAndCompanyId(String date, Long companyId) {
        return this.count(new LambdaQueryWrapper<LimitDownDO>().eq(LimitDownDO::getDate, date).eq(LimitDownDO::getCompanyId, companyId));
    }

    @Override
    public List<LimitDown> findByDate(String date) {
        return this.list(new LambdaQueryWrapper<LimitDownDO>().eq(LimitDownDO::getDate, date));
    }

}
